package com.ynby.yp.serviceimpl;

import com.ynby.yp.dao.DruginforeDao;
import com.ynby.yp.Pojo.DruginforePojo;
import com.ynby.yp.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class IndexServiceImpl implements IndexService {
    @Autowired
    DruginforeDao druginforeDao;

    @Override
    public List<DruginforePojo> query(DruginforePojo druginforePojo) {
        return druginforeDao.query(druginforePojo);
    }

    @Override
    public String add(DruginforePojo druginforePojo) {
        int n =  druginforeDao.addtablea(druginforePojo);
        druginforePojo.setId(druginforeDao.queryID(druginforePojo).getDid());
        int m = druginforeDao.addtableb(druginforePojo);
        if(n == 1&&m==1){
            return "添加信息成功";
        }else {
            return "添加信息失败";
        }
    }
    @Override
    public DruginforePojo alert(DruginforePojo druginforePojo) {
        return null;
    }
}
